package boerse.main.Asset;

import boerse.main.Exceptions.NegativeValueException;

import java.net.MalformedURLException;

/**
 * Define a single Share
 * @author Domi
 *
 */
public class Share {
	private final String name;
	private long price;
    private String datei;
	
	public Share (String name, long price) {
		this.name = name;
        this.price = price;
	}

    public Share (String name, long price, String datei) throws MalformedURLException {
        this.name = name;
        this.price = price;
        this.datei = datei;
    }

	public long getPrice() {
		return price;
	}

	public void setPrice(long price) throws NegativeValueException{
		if (price < 1)
			throw new NegativeValueException("No negative money is allowed");
		this.price = price;
	}

	public String getName() {
		return name;
	}
	
	public String toString() {
		return name + ":" + price;
	}

    public String getData() {
        return "" + datei;
    }
	
}
